Traditional graphics rendering hardware clips geometric primitives (polygons, lines, points, etc.) to a view volume prior to rasterization based on the vertices that make up each primitive. Typically, the view volume is defined by six clipping planes (top, bottom, left, right, front, and back) and the clipping process uses homogeneous clip coordinates. After clipping and a perspective divide, vertex coordinates are referred to as “normalized device coordinates”. Further viewport and depth range transformations (i.e. a scale and bias) convert normalized device coordinates to window coordinates. Subsequent primitive assembly, rasterization, and interpolation steps use these window coordinates.
Clipping based on the left, right, top, and bottom clip planes guarantees that the rasterized pixels for a clipped primitive are within the rectangular screen region defined by the viewport. Additionally, clipping based on the near and far clip planes guarantees that the depth values for rasterized pixels are within the representable range of the depth buffer (i.e. 16-bit or 24-bit integers).
Use of near and far plane clipping is well established. The OpenGL® and Direct3D® programming interfaces both assume near and far plane clipping. Ignoring the near and far clip planes has been discussed in the literature and hardware implementations of such rasterizers are available. For more information such topic, reference may be made to: Olano, Marc and Trey Greer, “Triangle Scan Conversion Using 2D Homogeneous Coordinates”, Proceedings of the 1997 SIGGRAPH/Eurographics Workshop on Graphics Hardware (Los Angeles, Calif., Aug. 2–4, 1997), ACM SIGGRAPH, New York, 1995; and James Blinn, Jim Blinn's Corner: A Trip Down the Graphics Pipeline, Morgan Kaufmann, 1996; which are each incorporated herein by reference in their entirety.
Prior art FIG. 1 illustrates a clipping operation 10 involving a near plane 12 and a far plane 14. During such clipping operation 10, the rasterization of primitives 16 that extend beyond such near plane 12 and far plane 14 are truncated at the planes. A primitive 11 entirely behind the far clip plane 14 or a primitive 13 entirely in front of the near clip plane 16 is eliminated entirely. As shown in FIG. 1, the foregoing truncation may involve defining additional triangles 18 at the near plane 12 and far plane 14.
Mathematically, the primitives may, in fact, extend beyond the near and/or far clip planes (12 and 16), but truncation of the primitive occurs for the sake of rasterization hardware which traditionally uses fixed-point math for depth values for reasons of hardware efficiency and performance. Such operations are limited in their numeric range.
In several cases, near and far plane clipping is undesirable. Polygons such as an unbounded ground plane going off into the horizon are clipped to the far clip plane rather than extending to the horizon line. There is thus a need for a system and method capable of permitting such polygons to be rasterized correctly even if otherwise incorrect depth values result.
Another situation where near and far plane clipping is undesirable is stenciled shadow volumes for rendering shadowed scenes. Shadow volume algorithms rely on drawing closed polygonal boundaries to separate shadowed regions from lit regions. Unfortunately, when shadow volumes are clipped by the far and/or near clip planes, these polygonal boundaries are no longer closed due to clipping. This leads to incorrect shadow determination. There is thus a further need for a system and method capable of permitting shadow volumes to be rendered without shadow determination artifacts caused by far and/or near plane clipping.